package com.example.demo.controller;

import com.example.demo.common.Result;
import com.example.demo.entity.BaseBiz;
import com.example.demo.service.BaseBizService;
import lombok.AllArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/baseBiz")
@AllArgsConstructor
public class BaseBizController {

    // 假设有一个BaseBizService类来处理业务逻辑
    private final BaseBizService baseBizService;


    // 创建BaseBiz实例
    @PostMapping("/create")
    @ResponseBody
    public Result createBaseBiz(@RequestBody BaseBiz baseBiz) {
         baseBizService.create(baseBiz);
         return Result.success();
    }

    // 获取BaseBiz实例的详细信息
    @GetMapping("/detail/{id}")
    public BaseBiz getBaseBizDetail(@PathVariable String id) {
        return baseBizService.detail(id);
    }

    // 列出所有BaseBiz实例
    @PostMapping("/list/{page}/{size}")
    public Page<BaseBiz> listBaseBiz(@PathVariable("page") int page,@PathVariable("size") int size,@RequestBody BaseBiz baseBiz) {
        return baseBizService.list(baseBiz,page,size);
    }
}
